home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / Serial.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  9.5 KB  |  257 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Serial.a
  3. ;
  4. ;    Contains:    Asynchronous Serial Driver (.AIn/.AOut/.BIn/.BOut) Interfaces
  5. ;
  6. ;    Version:    Technology:    System 7.6+
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__SERIAL__') = 'UNDEFINED' THEN
  19. __SERIAL__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.  
  25.  
  26. baud150                            EQU        763
  27. baud300                            EQU        380
  28. baud600                            EQU        189
  29. baud1200                        EQU        94
  30. baud1800                        EQU        62
  31. baud2400                        EQU        46
  32. baud3600                        EQU        30
  33. baud4800                        EQU        22
  34. baud7200                        EQU        14
  35. baud9600                        EQU        10
  36. baud14400                        EQU        6
  37. baud19200                        EQU        4
  38. baud28800                        EQU        2
  39. baud38400                        EQU        1
  40. baud57600                        EQU        0
  41.  
  42. stop10                            EQU        16384
  43. stop15                            EQU        -32768
  44. stop20                            EQU        -16384
  45.  
  46. noParity                        EQU        0
  47. oddParity                        EQU        4096
  48. evenParity                        EQU        12288
  49.  
  50. data5                            EQU        0
  51. data6                            EQU        2048
  52. data7                            EQU        1024
  53. data8                            EQU        3072
  54.  
  55. aData                            EQU        6                    ; channel A data in or out (historical) 
  56. aCtl                            EQU        2                    ; channel A control (historical) 
  57. bData                            EQU        4                    ; channel B data in or out (historical) 
  58. bCtl                            EQU        0                    ; channel B control (historical) 
  59.  
  60. dsrEvent                        EQU        2                    ; flag for SerShk.evts 
  61. riEvent                            EQU        4                    ; flag for SerShk.evts 
  62. dcdEvent                        EQU        8                    ; flag for SerShk.evts 
  63. ctsEvent                        EQU        32                    ; flag for SerShk.evts 
  64. breakEvent                        EQU        128                    ; flag for SerShk.evts 
  65.  
  66. xOffWasSent                        EQU        128                    ; flag for SerStaRec.xOffSent 
  67. dtrNegated                        EQU        64                    ; flag for SerStaRec.xOffSent 
  68. rtsNegated                        EQU        32                    ; flag for SerStaRec.xOffSent 
  69.  
  70. ainRefNum                        EQU        -6                    ; serial port A input 
  71. aoutRefNum                        EQU        -7                    ; serial port A output 
  72. binRefNum                        EQU        -8                    ; serial port B input 
  73. boutRefNum                        EQU        -9                    ; serial port B output 
  74.  
  75. swOverrunErr                    EQU        1                    ; serial driver error masks 
  76. breakErr                        EQU        8                    ; serial driver error masks 
  77. parityErr                        EQU        16                    ; serial driver error masks 
  78. hwOverrunErr                    EQU        32                    ; serial driver error masks 
  79. framingErr                        EQU        64                    ; serial driver error masks 
  80.  
  81. kOptionPreserveDTR                EQU        128                    ; option bit used with Control code 16 
  82. kOptionClockX1CTS                EQU        64                    ; option bit used with Control code 16 
  83.  
  84. kUseCTSOutputFlowControl        EQU        128                    ; flag for SerShk.fCTS 
  85. kUseDSROutputFlowControl        EQU        64                    ; flag for SerShk.fCTS 
  86. kUseRTSInputFlowControl            EQU        128                    ; flag for SerShk.fDTR 
  87. kUseDTRInputFlowControl            EQU        64                    ; flag for SerShk.fDTR 
  88.  
  89. sPortA                            EQU        0                    ; Macintosh modem port 
  90. sPortB                            EQU        1                    ; Macintosh printer port 
  91. sCOM1                            EQU        2                    ; RS-232 port COM1 
  92. sCOM2                            EQU        3                    ; RS-232 port COM2 
  93. ; typedef SInt8                         SPortSel
  94.  
  95. ;  csCodes for serial driver Control routines 
  96.  
  97. kSERDConfiguration                EQU        8                    ; program port speed, bits/char, parity, and stop bits 
  98. kSERDInputBuffer                EQU        9                    ; set buffer for chars received with no read pending 
  99. kSERDSerHShake                    EQU        10                    ; equivalent to SerHShake, largely obsolete 
  100. kSERDClearBreak                    EQU        11                    ; assert break signal on output 
  101. kSERDSetBreak                    EQU        12                    ; negate break state on output 
  102. kSERDBaudRate                    EQU        13                    ; set explicit baud rate, other settings unchanged 
  103. kSERDHandshake                    EQU        14                    ; superset of 10, honors setting of fDTR 
  104. kSERDClockMIDI                    EQU        15                    ; clock externally on CTS with specified multiplier 
  105. kSERDMiscOptions                EQU        16                    ; select clock source and DTR behavior on close 
  106. kSERDAssertDTR                    EQU        17                    ; assert DTR output 
  107. kSERDNegateDTR                    EQU        18                    ; negate DTR output 
  108. kSERDSetPEChar                    EQU        19                    ; select char to replace chars with invalid parity 
  109. kSERDSetPEAltChar                EQU        20                    ; select char to replace char that replaces chars with invalid parity 
  110. kSERDSetXOffFlag                EQU        21                    ; set XOff output flow control (same as receiving XOff) 
  111. kSERDClearXOffFlag                EQU        22                    ; clear XOff output flow control (same as receiving XOn) 
  112. kSERDSendXOn                    EQU        23                    ; send XOn if input flow control state is XOff 
  113. kSERDSendXOnOut                    EQU        24                    ; send XOn regardless of input flow control state 
  114. kSERDSendXOff                    EQU        25                    ; send XOff if input flow control state is XOn 
  115. kSERDSendXOffOut                EQU        26                    ; send XOff regardless of input flow control state 
  116. kSERDResetChannel                EQU        27                    ; reset serial I/O channel hardware 
  117. kSERDHandshakeRS232                EQU        28                    ; extension of 14, allows full RS-232 hardware handshaking 
  118. kSERDStickParity                EQU        29                    ; use mark/space parity 
  119. kSERDAssertRTS                    EQU        30                    ; assert RTS output 
  120. kSERDNegateRTS                    EQU        31                    ; negate RTS output 
  121. kSERD115KBaud                    EQU        115                    ; set 115.2K baud data rate 
  122. kSERD230KBaud                    EQU        230                    ; set 230.4K baud data rate 
  123.  
  124. ;  csCodes for serial driver Status routines 
  125.  
  126. kSERDInputCount                    EQU        2                    ; return characters available (SerGetBuf) 
  127. kSERDStatus                        EQU        8                    ; return characters available (SerStatus) 
  128. kSERDVersion                    EQU        9                    ; return version number in first byte of csParam 
  129. kSERDGetDCD                        EQU        256                    ; get instantaneous state of DCD (GPi) 
  130.  
  131. SerShk                    RECORD 0
  132. fXOn                     ds.b    1                ; offset: $0 (0)        ;  XOn/XOff output flow control flag 
  133. fCTS                     ds.b    1                ; offset: $1 (1)        ;  hardware output flow control flags 
  134. xOn                         ds.b    1                ; offset: $2 (2)        ;  XOn character 
  135. xOff                     ds.b    1                ; offset: $3 (3)        ;  XOff character 
  136. errs                     ds.b    1                ; offset: $4 (4)        ;  errors mask bits 
  137. evts                     ds.b    1                ; offset: $5 (5)        ;  event enable mask bits 
  138. fInX                     ds.b    1                ; offset: $6 (6)        ;  XOn/XOff input flow control flag 
  139. fDTR                     ds.b    1                ; offset: $7 (7)        ;  hardware input flow control flags 
  140. sizeof                     EQU *                    ; size:   $8 (8)
  141.                         ENDR
  142. SerStaRec                RECORD 0
  143. cumErrs                     ds.b    1                ; offset: $0 (0)        ;  errors accumulated since last SerStatus() call 
  144. xOffSent                 ds.b    1                ; offset: $1 (1)        ;  input (requested to be) held off by xOffWasSent or dtrNegated or rtsNegated 
  145. rdPend                     ds.b    1                ; offset: $2 (2)        ;  incomplete read pending in I/O queue 
  146. wrPend                     ds.b    1                ; offset: $3 (3)        ;  incomplete write pending in I/O queue 
  147. ctsHold                     ds.b    1                ; offset: $4 (4)        ;  transmit disabled by hardware handshaking 
  148. xOffHold                 ds.b    1                ; offset: $5 (5)        ;  transmit disabled by XOn/XOff handshaking 
  149. dsrHold                     ds.b    1                ; offset: $6 (6)        ;  transmit disabled: external device not ready 
  150. modemStatus                 ds.b    1                ; offset: $7 (7)        ;  reports modem status according to SerShk.evts 
  151. sizeof                     EQU *                    ; size:   $8 (8)
  152.                         ENDR
  153.     IF OLDROUTINENAMES THEN
  154. ;  ********************************************************************************************* 
  155. ;  The following constant names have been retired in favor of standard, more descriptive names.  
  156. ;  You can still compile old code by defining OLDROUTINENAMES. There were several constants that 
  157. ;  were formerly available that have been removed, as they are now regarded as either private or 
  158. ;  unsupported. We advise that you stop using any constants that are not defined in this file.   
  159. ;  ********************************************************************************************* 
  160.  
  161. serdOptionClockExternal            EQU        64                    ; option bit used with Control code 16 
  162. serdOptionPreserveDTR            EQU        128                    ; option bit used with Control code 16 
  163. ;  csCodes for serial driver Control routines 
  164.  
  165. serdReset                        EQU        8
  166. serdSetBuf                        EQU        9
  167. serdHShake                        EQU        10
  168. serdClrBrk                        EQU        11
  169. serdSetBrk                        EQU        12
  170. serdSetBaud                        EQU        13
  171. serdHShakeDTR                    EQU        14
  172. serdSetMIDI                        EQU        15
  173. serdSetMisc                        EQU        16
  174. serdSetDTR                        EQU        17
  175. serdClrDTR                        EQU        18
  176. serdSetPEChar                    EQU        19
  177. serdSetPECharAlternate            EQU        20
  178. serdSetXOff                        EQU        21
  179. serdClrXOff                        EQU        22
  180. serdSendXOnConditional            EQU        23
  181. serdSendXOn                        EQU        24
  182. serdSendXOffConditional            EQU        25
  183. serdSendXOff                    EQU        26
  184. serdChannelReset                EQU        27
  185. serdSet230KBaud                    EQU        230                    ; set 230K baud data rate 
  186.  
  187. ;  csCodes for serial driver Status routines 
  188.  
  189. serdGetBuf                        EQU        2
  190. serdStatus                        EQU        8
  191. serdGetVers                        EQU        9
  192.     ENDIF    ; OLDROUTINENAMES
  193. ;    The following interfaces are for the legacy high-level serial driver glue in
  194. ;    the interface libraries of your development system. They merely substitue for
  195. ;    the corresponding synchronous calls to PBControl and PBStatus.
  196. ;
  197. ;    They have not been updated as the serial driver API has evolved. Take note:
  198. ;
  199. ;        SerHShake does not support hardware input flow control. Use csCode 14.
  200. ;        SerStatus returns only the first six bytes of SerStaRec (through xOffHold).
  201. ;
  202.  
  203. ;
  204. ; pascal OSErr SerReset(short refNum, short serConfig)
  205. ;
  206.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  207.         IMPORT_CFM_FUNCTION SerReset
  208.     ENDIF
  209.  
  210. ;
  211. ; pascal OSErr SerSetBuf(short refNum, Ptr serBPtr, short serBLen)
  212. ;
  213.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  214.         IMPORT_CFM_FUNCTION SerSetBuf
  215.     ENDIF
  216.  
  217. ;
  218. ; pascal OSErr SerHShake(short refNum, const SerShk *flags)
  219. ;
  220.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  221.         IMPORT_CFM_FUNCTION SerHShake
  222.     ENDIF
  223.  
  224. ;
  225. ; pascal OSErr SerSetBrk(short refNum)
  226. ;
  227.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  228.         IMPORT_CFM_FUNCTION SerSetBrk
  229.     ENDIF
  230.  
  231. ;
  232. ; pascal OSErr SerClrBrk(short refNum)
  233. ;
  234.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  235.         IMPORT_CFM_FUNCTION SerClrBrk
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal OSErr SerGetBuf(short refNum, long *count)
  240. ;
  241.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  242.         IMPORT_CFM_FUNCTION SerGetBuf
  243.     ENDIF
  244.  
  245. ;
  246. ; pascal OSErr SerStatus(short refNum, SerStaRec *serSta)
  247. ;
  248.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  249.         IMPORT_CFM_FUNCTION SerStatus
  250.     ENDIF
  251.  
  252.  
  253.  
  254.     ENDIF ; __SERIAL__ 
  255.  
  256.